package com.example.demo.controller;

import com.example.demo.bean.Student;
import org.apache.juli.logging.LogFactory;
import org.slf4j.ILoggerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

import java.util.concurrent.atomic.AtomicInteger;

@RestController
@RequestMapping("/first")
public class HelloController {
    private Logger logger = LoggerFactory.getLogger(HelloController.class);
    public static final String EXAMPLE = "hello";
    private AtomicInteger count = new AtomicInteger(0);



    @PostMapping("/hello")
    public String hello(@RequestBody Student student){
        logger.info("message count: {}", count);
        return "hello "+student+ " : " + count.incrementAndGet();
    }


    @GetMapping("/hello2")
    public String hello() {
        return "hello  : " + count.incrementAndGet();
    }
}
